import request from '@/utils/request'
// 获取分类列表
export function getCategoryList(params) {
  return request({
    url: '/categories',
    method: 'get',
    params
  })
}
// 新建分类
export function addCategory(data) {
  return request({
    url: '/categories',
    method: 'post',
    data
  })
}
// 删除分类
export function delCategory(id) {
  return request({
    url: `/categories/${id}`,
    method: 'delete'

  })
}
// 根据id获取分类
export function getCategoryDetail(id) {
  return request({
    url: `/categories/${id}`

  })
}
// 根据id编辑分类
export function editCategory(data) {
  return request({
    url: `/categories/${data.id}`,
    method: 'put',
    data
  })
}
// 根据关键字搜索数据
export function searchCategory(params) {
  return request({
    url: '/categories/count',
    params
  })
}
